<%--
  Created by IntelliJ IDEA.
  User: 17728
  Date: 2020/10/12
  Time: 15:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script>
        window.onload = function fun() {
            $.ajax({
                url: "http://localhost:8080/Work_war_exploded/NoticeServlet",
                data: {action: "queryNotice2"},
                type: "GET",
                success: function (data) {
                    var jsonObj = JSON.parse(data);
                    var str = "";
                    $.each(jsonObj, function (index, notice) {
                        str += "<tr align=\"center\">" +
                            "<td colspan=\"2\">" + notice.id + "</td>" +
                            "<td colspan=\"2\">" + notice.title + "</td>" +
                            "<td><a href='NoticeServlet?action=queryNoticeById&id=" + notice.id + "'> 查看</td>" +
                            "<td><a href='NoticeServlet?action=queryNoticeById1&id=" + notice.id + "'>修改</td>" +
                            "<td><a  class=\"deleteItem\" href='NoticeServlet?action=deleteNotice&id=" + notice.id + "'>删除</td></tr>";
                    })
                    $("#tbody").html(str);
                    // $("#title1").html("标题："+jsonObj[0].title)
                },
                fail: function (data) {
                    $("#tbody").html("<p>1<p>");
                },
                dataType: "text"
            });

        }
        $(function () {
            // 给 【删除】绑定单击事件
            $("a.deleteItem").click(function () {
                return confirm("你确定要删除 【" + $(this).parent().parent().find("td:first").text() + "】吗?")
            });
        });
    </script>
    <%@ include file="/pages/common/head.jsp" %>
    <style type="text/css">
        .a {
            width: 60vw;
            height: 550px;
            margin: 0 auto;
            position: relative;
            top: 50px;
        }

        .b {

            height: 480px;
        }

        .d {
            text-align: center;
            position: relative;
            bottom: 0px;

        }
    </style>
</head>
<body>
<div class="a">
    <div class="b">

        <table class="table table-hover">
            <thead align="center">
            <tr>
                <td colspan="7"><h3><a href="pages/admin/board/admin_board_edit.jsp">添加公告板</a></h3></td>
            </tr>
            <tr>
                <td colspan="2">id</td>
                <td colspan="2">标题</td>
                <td colspan="3">操作</td>
            </tr>
            </thead>
            <tbody id="tbody" align="center">

            </tbody>
            <%--      <tr align="center">--%>

            <%--        <td colspan="4">标题</td>--%>
            <%--        <td>查看</td>--%>
            <%--      </tr>--%>
            <%--      <tr align="center">--%>
            <%--        <td colspan="4" id="title1"></td>--%>
            <%--        <td>查看</td>--%>
            <%--      </tr>--%>


        </table>
    </div>

</div>

</body>
</html>
